package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串：");
        FileOutputStream fos =new FileOutputStream("node1.txt",true);
        String a ="exit";
        String fileName = scanner.nextLine();
        if (fileName.equals(a)){
            System.out.println("退出");
        }
        while (fileName!=null&&!(fileName.equals(a))){
            fos.write(fileName.getBytes(StandardCharsets.UTF_8));
            System.out.println("输入完成");
            break;
        }
        fos.close();
    }
}
